/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ventanas;

import controlador.CtrlVista;
import negocio.Complejo;

/**
 *
 * @author Diego
 */
public class MainFrame extends javax.swing.JFrame {
    
    private CtrlVista vista;// = new CtrlVista();
    
    

    /**
     * Creates new form MainFrame
     */
    public MainFrame() {
        try{
            initComponents();      
            this.vista = new CtrlVista();
            String tituloVentana = "Sistema venta entradas - " + CtrlVista.getUnComplejo().getNombre();
            this.setTitle(tituloVentana);
        }
        catch(Exception e){
            System.out.println("Error de Inicializacion");
        }
    }
    
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        menuSala = new javax.swing.JMenuItem();
        menuSeccion = new javax.swing.JMenuItem();
        menuFila = new javax.swing.JMenuItem();
        menuButaca = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        menuUsuario = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        menuEvento = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jMenu1.setText("Complejo");

        menuSala.setText("Salas");
        menuSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSalaActionPerformed(evt);
            }
        });
        jMenu1.add(menuSala);

        menuSeccion.setText("Secciones");
        menuSeccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSeccionActionPerformed(evt);
            }
        });
        jMenu1.add(menuSeccion);

        menuFila.setText("Filas");
        menuFila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuFilaActionPerformed(evt);
            }
        });
        jMenu1.add(menuFila);

        menuButaca.setText("Butacas");
        menuButaca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuButacaActionPerformed(evt);
            }
        });
        jMenu1.add(menuButaca);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Usuarios");

        menuUsuario.setText("Usuarios");
        menuUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuUsuarioActionPerformed(evt);
            }
        });
        jMenu2.add(menuUsuario);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Eventos");

        menuEvento.setText("Eventos");
        menuEvento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuEventoActionPerformed(evt);
            }
        });
        jMenu3.add(menuEvento);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Informes");
        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 616, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 439, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void menuUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuUsuarioActionPerformed
        // TODO add your handling code here:
        /*
        DlgVehiculo ventanaVehiculo = new DlgVehiculo(this, true, this.unaEmpresa);
        ventanaVehiculo.setLocationRelativeTo(this);
        ventanaVehiculo.setVisible(true);
        */
        
        
        FrmUser ventanaUsuario = new FrmUser(this,true);
        ventanaUsuario.setLocationRelativeTo(this);
        ventanaUsuario.setVisible(true);
    }//GEN-LAST:event_menuUsuarioActionPerformed

    private void menuSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSalaActionPerformed
        // TODO add your handling code here:
        
        FrmSala ventanaSala = new FrmSala(this, true);
        ventanaSala.setLocationRelativeTo(this);
        ventanaSala.setVisible(true);
    }//GEN-LAST:event_menuSalaActionPerformed

    private void menuSeccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSeccionActionPerformed
        // TODO add your handling code here:
        FrmSeccion ventana = new FrmSeccion(this,true);
        ventana.setLocationRelativeTo(this);
        ventana.setVisible(true);
        
    }//GEN-LAST:event_menuSeccionActionPerformed

    private void menuEventoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEventoActionPerformed
        // TODO add your handling code here:
        FrmEspectaculo ventana = new FrmEspectaculo(this, true);
        ventana.setLocationRelativeTo(this);
        ventana.setVisible(true);
    }//GEN-LAST:event_menuEventoActionPerformed

    private void menuButacaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuButacaActionPerformed
        // TODO add your handling code here:
        FrmButaca ventana = new FrmButaca(this,true);
        ventana.setLocationRelativeTo(this);
        ventana.setVisible(true);
    }//GEN-LAST:event_menuButacaActionPerformed

    private void menuFilaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFilaActionPerformed
        // TODO add your handling code here:
        FrmFila ventana = new FrmFila(this,true);
        ventana.setLocationRelativeTo(this);
        ventana.setVisible(true);
    }//GEN-LAST:event_menuFilaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem menuButaca;
    private javax.swing.JMenuItem menuEvento;
    private javax.swing.JMenuItem menuFila;
    private javax.swing.JMenuItem menuSala;
    private javax.swing.JMenuItem menuSeccion;
    private javax.swing.JMenuItem menuUsuario;
    // End of variables declaration//GEN-END:variables
}
